package org.nstack.kvm;

import org.nstack.utils.gson.JSONObjectUtil;

import java.util.LinkedHashMap;


public class KvmResponseWrapper {
    private LinkedHashMap response;
    private Object cache;

    public KvmResponseWrapper(LinkedHashMap response) {
        this.response = response;
    }



    public <T> T getResponse(Class<T> type) {
        if (cache == null) {
            cache = JSONObjectUtil.rehashObject(response, type);
        }

        return (T) cache;
    }
}
